#ifndef DEF_H
#define DEF_H
#include <type_traits>
#include <qglobal.h>
#include <qstring.h>

#define NOT_CALL
#define API

#if !defined(SDK_STATIC)
#if defined(SDK_BUILD)
#define SDK_API_IMPORT __declspec(dllimport)
#define SDK_API_EXPORT __declspec(dllexport)
#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
#else
#if __GNUC__ >= 4
// GCC 4 has special keywords for showing/hidding symbols,
// the same keyword is used for both importing and exporting
#define SDK_API_IMPORT __attribute__ ((__visibility__ ("default")))
#define SDK_API_EXPORT __attribute__ ((__visibility__ ("default")))
#else
// GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
#define SDK_API_IMPORT
#define SDK_API_EXPORT
#endif
#endif
#else
// Static build doesn't need import/export macros
#define SDK_API_IMPORT
#define SDK_API_EXPORT
#endif

#if defined(WIN32) || defined(WIN64)
#define SDK_APIENTRY __cdecl
#else
#define SDK_APIENTRY
#endif

#if defined(SDK_EXPORTS)
#define SDK_EXPORT_API SDK_API_EXPORT
#else
#define SDK_EXPORT_API SDK_API_IMPORT
#endif

template<class T>
class ItemManager;

class WidgetFrameLess;

class SDKCore;
class SDKCorePrivate;

class ScriptHelper;
class ScriptExecutor;

class Text;

class Addon;
class AddonPackage;
class AddonManager;

class EarthGraticule;

class ICamera;

class QEarth;
class QEarthPrivate;

class AbstractItem;
class AbstractLayer;
class SceneItem;

class QNode;
class QNodeContainer;

class QCreator;
class QCreatorHelper;

class Helper;
class StyleManager;
class StyleManagerPrivate;

class LayerManager;
class LayerManagerPrivate;

class DynTargetItemTrack;
class DynTargetItemSet;
class HistoryTrackLine;
class DynTargetManager;

#define DECLARE_PRIVATE(target)\
    target##Private* d_ptr = nullptr;\
public:\
    Q_DECLARE_PRIVATE(target)

#define DECLARE_PUBLIC(target)\
    Q_DECLARE_PUBLIC(target)\
    target* q_ptr = nullptr;

class IDeleter
{
public:
	virtual void destroy() = 0;
};

class IVisible
{
public:
	virtual void setVisible(bool visible) = 0;
	virtual bool isVisible()const = 0;
};

struct INamedObject
{
	virtual const QString getName()const = 0;
};

#define SET_PRIVATE_PTR_FUNCTION(PrivateClass)\
	virtual PrivateClass* getPrivateClass()\
	{\
		return nullptr;\
	}

template<class Private>
class PrivateClassHolder
{
public:
	virtual Private* getPrivateClass()
	{
		return nullptr;
	}
};

const constexpr int TEXT_ALIGN_LEFT_TOP = 0;
const constexpr int TEXT_ALIGN_LEFT_CENTER = 1;
const constexpr int TEXT_ALIGN_LEFT_BOTTOM = 2;
const constexpr int TEXT_ALIGN_CENTER_TOP = 3;
const constexpr int TEXT_ALIGN_CENTER_CENTER = 4;
const constexpr int TEXT_ALIGN_CENTER_BOTTOM = 5;
const constexpr int TEXT_ALIGN_RIGHT_TOP = 6;
const constexpr int TEXT_ALIGN_RIGHT_CENTER = 7;
const constexpr int TEXT_ALIGN_RIGHT_BOTTOM = 8;
const constexpr int TEXT_ALIGN_LEFT_BASE_LINE = 9;
const constexpr int TEXT_ALIGN_CENTER_BASE_LINE = 10;
const constexpr int TEXT_ALIGN_RIGHT_BASE_LINE = 11;
const constexpr int TEXT_ALIGN_LEFT_BOTTOM_BASE_LINE = 12;
const constexpr int TEXT_ALIGN_CENTER_BOTTOM_BASE_LINE = 13;
const constexpr int TEXT_ALIGN_RIGHT_BOTTOM_BASE_LINE = 14;
const constexpr int TEXT_ALIGN_BASE_LINE = TEXT_ALIGN_LEFT_BASE_LINE;
const constexpr int TEXT_ALIGN_MAX = TEXT_ALIGN_RIGHT_BOTTOM_BASE_LINE;

#define DEFAULT_VIEW_WIDTH  960
#define DEFAULT_VIEW_HEIGHT 640

#endif